zeek53.html and zeek53.js
zeek53.js
function greet(name,greetText="Default Greeting:Good day"){
console.log("....................")
console.log( name+ ' is a good person');
console.log(greetText+" "+name)
}
//greetText="Default Greeting:Good day" means when function is called and there is
no greetText it will take equal to value as default.
let name0="Zeeshan";
let name1="Nida";
let name2="Kashif";
let name3="Shaheen";
let greetText="Good Morning";
let greetText1="Good Evening";
greet(name0,greetText);
greet(name0,greetText1);
greet(name1,greetText);
greet(name1,greetText1);
greet(name2,greetText);
greet(name2,greetText1);
greet(name3);
greet(name3);
function sum(a,b,c){
console.log("....................")
d=a+b+c;
return d; //After return no code will be executed.
}
let returnValue = sum(1,2,30);
console.log("The sum of these numbers are: "+returnValue)
zeek53.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Functions in JavaScript</title>
</head>
<body>
<h1>What are the functions of JavaScript?</h1>
<p>In JavaScript, a function allows you to define a block of code, give it a name
and then execute it as many times as you want.</p>
<p>A JavaScript function can be defined using function keyword.</p>
<p>This is my body.For JavaScript please right click on body then click on inspect
and Go to console.</p>
<script src="zeek53.js"></script>
</body>
</html>
Comments
Post a Comment